<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body></body>
</html>
<script>
  //翻转字符串
  //封装函数
  function Str(str) {
    //先给字符串split转换成数组,再reverse翻转,再join转换成字符串
    return str.split("").reverse().join("");
  }
  var res = Str("abcdefgh");
  console.log(res);
</script>
